#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main() {
    char ming, li;
    scanf("%c %c", &ming, &li);

    if ((ming == 'O' && li == 'Y') || (ming == 'Y' && li == 'H') || (ming == 'H' && li == 'O')) {
        printf("MING");
    }
    else if ((ming == 'Y' && li == 'O') || (ming == 'H' && li == 'Y') || (ming == 'O' && li == 'H')) {
        printf("LI");
    }
    else {
        printf("TIE");
    }
    return 0;
}